/**
 * Created by chencheng on 17-8-31.
 */
import geojson from './geojson.json';
import { Component } from 'react';
import echarts from 'echarts';
import { MainHeader, MainContent } from 'templates/MainLayout/MainLayout';
import { EnumModalType } from 'constants/EnumType';
import ReactEcharts from 'echarts-for-react';
import beijing from './beijing2017';
import {
    Table, Button, Input, Icon, Modal, Form,
} from 'antd';

import T from 'utils/T';
// import Bar from 'templates/ToolComponents/D3Charts/Bar';


export default class Echarts extends Component {
    constructor(props) {
        super(props);
        this.state = {

        };
    }

    componentDidMount() {
        // 获取图表实例。用于调用echarts API
        this.map = echarts.init(this._map);

        // echarts.registerMap('china', geojson)

        window.map = this.map;
        this.map.setOption(this.getDefaultOptions());

    }

    getDefaultOptions() {

        return {
            visualMap: {
                show: false,
            },
            grid: {
                left: 0,
                top: 0,
                bottom: 0,
                right: 0,
                containLabel: true
            },

            series: [
                {
                    type: 'map',
                    mapType: 'beijing',
                }

            ]
        }
    }



    render() {

        return (
            <div>
                <MainHeader title="Echarts" />

                <MainContent>
                    <ReactEcharts
                        option={this.getDefaultOptions()}
                    />
                    <div
                        style={{
                            height: 420,
                            width: '1000px'
                        }}
                        ref={(e) => this._map = e}
                    />

                </MainContent>
            </div>
        );
    }
}

